package com.incar.chuxing.api;



import com.incar.chuxing.base.BaseResultBean;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public abstract class ApiObserver<T> implements Observer<BaseResultBean<T>> {

    @Override
    public void onSubscribe(Disposable d) {
        onLoading(d);

    }

    @Override
    public void onNext(BaseResultBean<T> result) {
        onLoaded(result);


    }

    @Override
    public void onError(Throwable e) {
        onLoadError(e);
    }

    @Override
    public void onComplete() {

    }


    public abstract void onLoading(Disposable disposable);

    public abstract void onLoaded(BaseResultBean<T> result);

    public abstract void onLoadError(Throwable t);
}
